package cn.edu.pku.controller;

import cn.edu.pku.service.CountInfoService;
import cn.edu.pku.vo.CountVo;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by ming.qin on 2017/5/8.
 */
@RestController
@Slf4j
public class CountController {
    @Autowired
    private CountInfoService countInfoService;

    @RequestMapping(value = "/listCount",method = RequestMethod.GET)
    @ApiOperation(value = "统计页统计信息", notes = "")
    public CountVo listCount() {
        CountVo vo = new CountVo();
        log.info(countInfoService.selectBookCount() + "");
        vo.setBookCount(countInfoService.selectBookCount());
        log.info(countInfoService.selectBorrowerCount() + "");
        vo.setBorrowerCount(countInfoService.selectBorrowerCount());
        log.info(countInfoService.selectBorrowInfoCount() + "");
        vo.setBorrowInfoCount(countInfoService.selectBorrowInfoCount());
        vo.setBookNoteCount(countInfoService.selectCountInfo());
        return vo;
    }
}
